package com.clt.ess.gjzw.domain.uploadRecordInfos;


import com.clt.ess.gjzw.domain.SignInfo;

import java.io.Serializable;
import java.util.List;

//上传备案信息接口请求业务参数
public class UploadRecordInfosRequest implements Serializable {
    //命令编码 uploadRecordInfos
    //必须
    private String taskCode;
    //版本号 1.0
    //必须
    private String version;
    //客户端随机数（randomA）与服务端随机数（randomB） 字符串拼接，中间无分割符号
    //必须
    private String tokenInfo;
    //业务类型编码，0 表示备案业务，1 表示保护密钥更新业务，2 表示印章撤销，3 表示申请电子印章唯一赋码业务
    //必须
    private String taskTypeCode;
    //UploadRecordInfosData类
    //必须
    private List<UploadRecordInfosRequestData> data;
    //签名信息：SignInfo类
    //必须
    private SignInfo signInfo;

    /**
     {
         "taskCode ": "uploadRecordInfos",
         "version ": "1.0",
         "tokenInfo": "randomA+randomB",
         "taskTypeCode": "0",
         "data": [{
             "sealEncCert": "BASE64 编码的电子印章加密证书",
             "sealSignCert": " BASE64 编码的电子印章签名证书",
             "sealData": {
             "yzmc": "印章名称",
             "yzbm": "印章编码",
             "yzzzdwbm": "印章制作单位编码",
             "yzlxdm": "印章类型代码",
             "jbr_xm": "经办人姓名",
             "jbr_zjlx": "经办人证件类型",
             "jbr_zjhm": "经办人证件号码",
             "zzrq": "制作日期",
             "ymlx": "印模类型",
             "ymsj": "印模数据",
             "yzsydw_dwmc": "印章使用单位_单位名称",
             "yzsydw_dwssmzwzmc": "印章使用单位_单位少数民族文字名称",
             "yzsydw_dwywmc": "印章使用单位_单位英文名称",
             "yzzzdw_dwmc": "印章制作单位_单位名称",
             "yzzzdw_dwssmzwzmc": "印章制作单位_单位少数民族文字名称",
             "yzzzdw_dwywmc": "印章制作单位_单位英文名称",
             "yzsydw_tyshxydm": "印章使用单位_统一社会信用代码"
         },
         "districtCode": "行政区划代码"
     }]
     }
     */

    public UploadRecordInfosRequest() {
    }

    public UploadRecordInfosRequest(String taskCode, String version, String tokenInfo, String taskTypeCode, List<UploadRecordInfosRequestData> data, SignInfo signInfo) {
        this.taskCode = taskCode;
        this.version = version;
        this.tokenInfo = tokenInfo;
        this.taskTypeCode = taskTypeCode;
        this.data = data;
        this.signInfo = signInfo;
    }

    public String getTaskCode() {
        return taskCode;
    }

    public void setTaskCode(String taskCode) {
        this.taskCode = taskCode;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getTokenInfo() {
        return tokenInfo;
    }

    public void setTokenInfo(String tokenInfo) {
        this.tokenInfo = tokenInfo;
    }

    public String getTaskTypeCode() {
        return taskTypeCode;
    }

    public void setTaskTypeCode(String taskTypeCode) {
        this.taskTypeCode = taskTypeCode;
    }

    public List<UploadRecordInfosRequestData> getData() {
        return data;
    }

    public void setData(List<UploadRecordInfosRequestData> data) {
        this.data = data;
    }

    public SignInfo getSignInfo() {
        return signInfo;
    }

    public void setSignInfo(SignInfo signInfo) {
        this.signInfo = signInfo;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("\"taskCode\":\"")
                .append(taskCode).append('\"');
        sb.append(",\"version\":\"")
                .append(version).append('\"');
        sb.append(",\"tokenInfo\":\"")
                .append(tokenInfo).append('\"');
        sb.append(",\"taskTypeCode\":\"")
                .append(taskTypeCode).append('\"');
        sb.append(",\"data\":")
                .append(data);
        if(signInfo!=null && signInfo.getSignValue()!=null && !"".equals(signInfo.getSignValue())){
            sb.append(",\"signInfo\":")
                    .append(signInfo);
        }
        sb.append('}');
        return sb.toString();
    }
}
